#pragma once

#if __has_include("avr/interrupt.h")

    #include <avr/interrupt.h>

    #define _ARDUINO_BASIC__ARCH_AVR 1

#elif __has_include("cmsis_compiler.h")

    #include <cmsis_compiler.h>

    #define _ARDUINO_BASIC__ARCH_CM 1

    #ifndef _ARDUINO_BASIC__ARCH_CM_CORE

        #ifndef __CORTEX_M
            #error "__CORTEX_M should be defined."
        #endif

        #define _ARDUINO_BASIC__ARCH_CM_CORE __CORTEX_M

    #endif


    #if (_ARDUINO_BASIC__ARCH_CM_CORE == 0)

        #include <core_cm0.h>  // cm0 或者cm0plus 都无所谓

    #elif (_ARDUINO_BASIC__ARCH_CM_CORE == 1)

        #include <core_cm1.h>

    #elif (_ARDUINO_BASIC__ARCH_CM_CORE == 3)

        #include <core_cm3.h>

    #elif (_ARDUINO_BASIC__ARCH_CM_CORE == 4)

        #include <core_cm4.h>

    #elif (_ARDUINO_BASIC__ARCH_CM_CORE == 7)

        #include <core_cm7.h>

    #elif (_ARDUINO_BASIC__ARCH_CM_CORE == 23)

        #include <core_cm23.h>

    #elif (_ARDUINO_BASIC__ARCH_CM_CORE == 33)

        #include <core_cm33.h>

    #else

        #error "Unknown cortex code."

    #endif

#endif